Fix hotkey display for non-US keyboard layouts (§/± key)#258
Fix hotkey display for non-US keyboard layouts (§/± key)#258shhac wants to merge 4 commits intoaltic-dev:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 154e4a5692
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b597ad678
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
if you can show me a video of before and after and take care of Codex reviews, we can try to sort this out soon! Thanks man |
Summary
Fixes #126
On non-US keyboards (e.g. British, German, French), some keys produce different characters than on a US layout. The hotkey display was using a hardcoded lookup table that mapped physical key codes to US keyboard characters — so key code 10 (the ISO key between Escape and Tab) was missing entirely, and punctuation keys like
[,;,'would show their US characters even on layouts where those keys produceü,ö,ä, etc.The broken fallback for unmapped keys converted the raw key code number to a Unicode character — key code 10 becomes U+000A (line feed), which is invisible. That's why the UI showed an empty box.
This PR replaces the hardcoded character table with a layout-aware lookup (
UCKeyTranslate) that asks macOS what character each key actually produces on the user's current keyboard layout. The hardcoded table is kept only for keys with semantic names (Return, Tab, Space, Delete, Escape, arrow keys, modifiers) where the name is more useful than the character.A US QWERTY fallback map is retained for edge cases where TIS layout data is unavailable (e.g. emoji or CJK input sources), so labels degrade gracefully rather than showing
?for every key.Test plan
§(or⇧ + §for±) as a hotkey — verify it renders correctly